package com.hnx.admin.aurora.system.mapper.menu;

import com.hnx.admin.aurora.annotation.AddInfo;
import com.hnx.admin.aurora.annotation.UpdateInfo;
import com.hnx.admin.aurora.system.domain.dto.menu.entity.MenuDTO;
import com.hnx.admin.aurora.system.domain.param.menu.form.MenuForm;
import com.hnx.admin.aurora.system.domain.param.menu.query.MenuQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Optional;
import java.util.Set;

public interface MenuMapper {
    Optional<Set<String>> getPermissionByUserId(String userId);
    List<MenuDTO> selectMenuTreeByUserId(String userId);
    List<MenuDTO> selectMenuAll();

    List<String> selectMenuListByRoleId(@Param("roleId") String roleId,@Param("menuCheckStrictly") boolean menuCheckStrictly);

    List<MenuDTO> selectMenuListByUser(MenuQuery menu);
    @AddInfo
    int insertMenu(MenuForm menu);
    @Select("select count(1) from sys_role_menu where menu_id = #{menuId}")
    int checkMenuExistRole(String menuId);

    @Update("update sys_menu set del_flag=1 where menu_id=#{menuId}")
    int deleteMenuById(String menuId);

    MenuDTO selectMenuById(String menuId);
    @UpdateInfo
    int updateMenu(MenuForm menu);
}
